<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="../angular-1.5.8/angular.js"></script>
    <style>
    
        .c{
            background-color: black;
        }
    
    </style>
</head>
<body >
    <div ng-app="mainApp" ng-controller="one" ng-class="{c:btn==='开'}">
        <!--<button ng-click="console.log('haha ')">click</button>-->
        <button ng-click="val=!val">点击修改变量</button>
        <div>{{val }}</div>

         <button ng-click="btn = btn === '关' ? '开' : '关' ">{{ btn }}</button>


    </div>
    
</body>
<script>
   angular.module( 'mainApp', [] )
        .controller( 'one', function ( $scope ) {
            $scope.btn = '关';

            $scope.val = true;

            // $scope.console = window.console;

        });
</script>
</html>